﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace LogisticsAdminMS
{
    public partial class TruckTeam : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            BindRpt();
        }

        private void BindRpt()
        {
            string sql = "SELECT  * FROM TruckTeam";
            List<TruckTeamModel> truckTeams = new List<TruckTeamModel>();
            SqlDataReader sdr = SQLHelper.ExecuteReader(sql);
            if (sdr.HasRows)
            {
                while (sdr.Read())
                {
                    TruckTeamModel model = new TruckTeamModel();
                    model.TeamID = Convert.ToInt32(sdr["TeamID"]);
                    model.TeamName = sdr["TeamName"].ToString();
                    truckTeams.Add(model);
                }
                sdr.Close();
            }
            gvTeamList.DataSource = truckTeams;
            gvTeamList.DataBind();
        }
    }
}